home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / BlitzC2P / c2p060only.ascii < prev    next >
Encoding:
Text File  |  1998-08-01  |  6.9 KB  |  435 lines

  1. WBStartup
  2. NoCli
  3.  
  4. ; CLEARSCREEN version. Additional code by Paul West.
  5.  
  6. ; Non-clearscreen results:
  7.  
  8. ; 040/25 results:
  9.  
  10. ; 320x200 @46.0fps DoublePAL or 48.2fps PAL
  11. ; 320x256 @34.2fps DoublePAL or 37.4fps PAL
  12. ; 320x240 @37.1fps DoublePAL or 40.1fps PAL
  13.  
  14. ; 060/50 results:
  15.  
  16. ; 320x256 @50fps PAL
  17. ; 320x200 @66fps PAL
  18.  
  19. #c2pBPLX=320
  20. #c2pBPLY=256
  21. #c2pBPLSIZE=(#c2pBPLX*#c2pBPLY)/8
  22.  
  23. #scrwidth=#c2pBPLX
  24. #scrheight=#c2pBPLY
  25. #screensize=#scrwidth*#scrheight
  26.  
  27. #clearscreento=$00000000
  28.  
  29. ; c2p1x1_8_c5_060
  30.  
  31. Statement c2p060onlyinit{A.l,B.l}
  32.  
  33.   ;A.l=d0=Width.w
  34.   ;B.l=d0=Height.w
  35.  
  36. ; d0.w  chunkyx [chunky-pixels]
  37. ; d1.w  chunkyy [chunky-pixels]
  38. ; d3.w  scroffsy [screen-pixels]
  39.  
  40.   MOVEQ.l #0,d3 ; Y offset
  41.  
  42. c2p1x1_8_c5_060_init
  43.   LEA c2p_datanew(pc),a0
  44.   ANDI.l  #$ffff,d0
  45.   MULU.w  d0,d3
  46.   LSR.l #3,d3
  47.   MOVE.l  d3,c2p_scroffs-c2p_data(a0)
  48.   MULU.w  d0,d1
  49.   MOVE.l  d1,c2p_pixels-c2p_data(a0)
  50. AsmExit
  51. End Statement
  52.  
  53. Statement c2p060only{A.l,B.l}
  54.  
  55.   MOVE.l  d0,a0 ; Chunky
  56.   MOVE.l  d1,a1 ; Planar
  57.  
  58. ; a0  c2pscreen
  59. ; a1  bitplanes
  60.  
  61. c2p1x1_8_c5_060
  62.   MOVE.w  #_xend-_x,d0
  63.  
  64.   MOVEM.l a3-a6,-(a7)
  65.  
  66.   MOVEM.l a0-a1,-(a7)
  67.   LEA c2p_datanew,a0
  68.   LEA c2p_data,a1
  69.   MOVEQ #16-1,d0
  70. _c2pcopy: MOVE.l  (a0)+,(a1)+
  71.   DBF d0,_c2pcopy
  72.   MOVEM.l (a7)+,a0-a1
  73.   MOVE.l  a7,stackstore
  74.   MOVE.l  #clearscreento,a7
  75.   LEA c2p_data(pc),a2
  76.  
  77.   ADD.w #c2pBPLSIZE,a1
  78.   ADD.l c2p_scroffs-c2p_data(a2),a1
  79.  
  80.   MOVE.l  c2p_pixels-c2p_data(a2),a3
  81.   ADD.l a0,a3
  82.  
  83.   MOVE.l  a1,a2
  84.   ADD.l #c2pBPLSIZE*4,a2
  85.  
  86.   CMP.l a0,a3
  87.   BEQ _none
  88.  
  89.   MOVE.l  (a0),d0
  90.   MOVE.l  a7,(a0)+
  91.   MOVE.l  (a0),d1
  92.   MOVE.l  a7,(a0)+
  93.   MOVE.l  (a0),d2
  94.   MOVE.l  a7,(a0)+
  95.   MOVE.l  (a0),d3
  96.   MOVE.l  a7,(a0)+
  97.  
  98.   MOVE.l  #$0f0f0f0f,d5   ; Swap 4x1, parts 1 & 2
  99.   MOVE.l  d1,d6
  100.   MOVE.l  d3,d7
  101.   LSR.l #4,d6
  102.   LSR.l #4,d7
  103.   EOR.l d0,d6
  104.   EOR.l d2,d7
  105.   AND.l d5,d6
  106.   AND.l d5,d7
  107.   EOR.l d6,d0
  108.   EOR.l d7,d2
  109.   LSL.l #4,d6
  110.   LSL.l #4,d7
  111.   EOR.l d6,d1
  112.   EOR.l d7,d3
  113.  
  114.   MOVE.l  d0,a4
  115.   MOVE.l  d1,a5
  116.   MOVE.l  d2,a6
  117.   MOVE.l  d3,d5
  118.  
  119.   MOVE.l  (a0),d0
  120.   MOVE.l  a7,(a0)+
  121.   MOVE.l  (a0),d1
  122.   MOVE.l  a7,(a0)+
  123.   MOVE.l  (a0),d2
  124.   MOVE.l  a7,(a0)+
  125.   MOVE.l  (a0),d3
  126.   MOVE.l  a7,(a0)+
  127.  
  128.   MOVE.l  d1,d6     ; Swap 4x1, parts 3 & 4
  129.   MOVE.l  d3,d7
  130.   LSR.l #4,d6
  131.   LSR.l #4,d7
  132.   EOR.l d0,d6
  133.   EOR.l d2,d7
  134.   AND.l #$0f0f0f0f,d6
  135.   AND.l #$0f0f0f0f,d7
  136.   EOR.l d6,d0
  137.   EOR.l d7,d2
  138.   LSL.l #4,d6
  139.   LSL.l #4,d7
  140.   EOR.l d6,d1
  141.   EOR.l d7,d3
  142.  
  143.   EXG d1,a4
  144.   EXG d3,a6
  145.  
  146.   MOVE.w  d0,d6     ; Swap 16x4, parts 1 & 3
  147.   MOVE.w  d2,d7
  148.   MOVE.w  d1,d0
  149.   MOVE.w  d3,d2
  150.   SWAP  d0
  151.   SWAP  d2
  152.   MOVE.w  d0,d1
  153.   MOVE.w  d2,d3
  154.   MOVE.w  d6,d0
  155.   MOVE.w  d7,d2
  156.  
  157.   BRA _start
  158. _x
  159.   MOVE.l  (a0),d0
  160.   MOVE.l  a7,(a0)+
  161.   MOVE.l  (a0),d1
  162.   MOVE.l  a7,(a0)+
  163.   MOVE.l  (a0),d2
  164.   MOVE.l  a7,(a0)+
  165.   MOVE.l  (a0),d3
  166.   MOVE.l  a7,(a0)+
  167.  
  168.   MOVE.l  d7,c2pBPLSIZE*2(a1)
  169.  
  170.   MOVE.l  #$0f0f0f0f,d5   ; Swap 4x1, parts 1 & 2
  171.   MOVE.l  d1,d6
  172.   MOVE.l  d3,d7
  173.   LSR.l #4,d6
  174.   LSR.l #4,d7
  175.   EOR.l d0,d6
  176.   EOR.l d2,d7
  177.   AND.l d5,d6
  178.   AND.l d5,d7
  179.   MOVE.l  a6,-c2pBPLSIZE(a1)
  180.   EOR.l d6,d0
  181.   EOR.l d7,d2
  182.   LSL.l #4,d6
  183.   LSL.l #4,d7
  184.   EOR.l d6,d1
  185.   EOR.l d7,d3
  186.  
  187.   MOVE.l  a5,d7
  188.  
  189.   MOVE.l  d0,a4
  190.   MOVE.l  d1,a5
  191.   MOVE.l  d2,a6
  192.   MOVE.l  d3,d5
  193.  
  194.   MOVE.l  (a0),d0
  195.   MOVE.l  a7,(a0)+
  196.   MOVE.l  (a0),d1
  197.   MOVE.l  a7,(a0)+
  198.   MOVE.l  (a0),d2
  199.   MOVE.l  a7,(a0)+
  200.   MOVE.l  (a0),d3
  201.   MOVE.l  a7,(a0)+
  202.  
  203.   MOVE.l  d7,(a1)+
  204.  
  205.   MOVE.l  d1,d6     ; Swap 4x1, parts 3 & 4
  206.   MOVE.l  d3,d7
  207.   LSR.l #4,d6
  208.   LSR.l #4,d7
  209.   EOR.l d0,d6
  210.   EOR.l d2,d7
  211.   AND.l #$0f0f0f0f,d6
  212.   AND.l #$0f0f0f0f,d7
  213.   EOR.l d6,d0
  214.   EOR.l d7,d2
  215.   LSL.l #4,d6
  216.   LSL.l #4,d7
  217.   EOR.l d6,d1
  218.   EOR.l d7,d3
  219.  
  220.   EXG d1,a4
  221.   EXG d3,a6
  222.  
  223.   MOVE.w  d0,d6     ; Swap 16x4, parts 1 & 3
  224.   MOVE.w  d2,d7
  225.   MOVE.w  d1,d0
  226.   MOVE.w  d3,d2
  227.   SWAP  d0
  228.   SWAP  d2
  229.   MOVE.w  d0,d1
  230.   MOVE.w  d2,d3
  231.   MOVE.w  d6,d0
  232.   MOVE.w  d7,d2
  233.  
  234.   MOVE.l  d4,c2pBPLSIZE-4(a1)
  235. _start
  236.   MOVE.l  #$33333333,d4   ; Swap 2x4, parts 1 & 3
  237.   MOVE.l  d0,d6
  238.   MOVE.l  d2,d7
  239.   LSR.l #2,d6
  240.   LSR.l #2,d7
  241.   EOR.l d1,d6
  242.   EOR.l d3,d7
  243.   AND.l d4,d6
  244.   AND.l d4,d7
  245.   EOR.l d6,d1
  246.   EOR.l d7,d3
  247.   LSL.l #2,d6
  248.   LSL.l #2,d7
  249.   EOR.l d6,d0
  250.   EOR.l d7,d2
  251.  
  252.   MOVE.l  #$00ff00ff,d4   ; Swap 8x2, parts 1 & 3
  253.   MOVE.l  d2,d6
  254.   MOVE.l  d3,d7
  255.   LSR.l #8,d6
  256.   LSR.l #8,d7
  257.   EOR.l d0,d6
  258.   EOR.l d1,d7
  259.   AND.l d4,d6
  260.   AND.l d4,d7
  261.   EOR.l d6,d0
  262.   EOR.l d7,d1
  263.   LSL.l #8,d6
  264.   LSL.l #8,d7
  265.   EOR.l d6,d2
  266.   EOR.l d7,d3
  267.  
  268.   MOVE.l  #$55555555,d4   ; Swap 1x2, parts 1 & 3
  269.   MOVE.l  d2,d6
  270.   MOVE.l  d3,d7
  271.   LSR.l #1,d6
  272.   LSR.l #1,d7
  273.   EOR.l d0,d6
  274.   EOR.l d1,d7
  275.   AND.l d4,d6
  276.   AND.l d4,d7
  277.   EOR.l d6,d0
  278.   EOR.l d7,d1
  279.   MOVE.l  d1,c2pBPLSIZE*2(a2)
  280.   ADD.l d6,d6
  281.   ADD.l d7,d7
  282.   EOR.l d6,d2
  283.   EOR.l d7,d3
  284.  
  285.   EXG a5,d0
  286.   EXG d5,d1
  287.   EXG a4,d2
  288.   EXG a6,d3
  289.  
  290.   MOVE.w  d2,d6     ; Swap 16x4, parts 2 & 4
  291.   MOVE.w  d3,d7
  292.   MOVE.w  d0,d2
  293.   MOVE.w  d1,d3
  294.   SWAP  d2
  295.   SWAP  d3
  296.   MOVE.l  a6,c2pBPLSIZE(a2)
  297.   MOVE.w  d2,d0
  298.   MOVE.w  d3,d1
  299.   MOVE.w  d6,d2
  300.   MOVE.w  d7,d3
  301.  
  302.   MOVE.l  #$33333333,d4   ; Swap 2x4, parts 2 & 4
  303.   MOVE.l  d2,d6
  304.   MOVE.l  d3,d7
  305.   LSR.l #2,d6
  306.   LSR.l #2,d7
  307.   EOR.l d0,d6
  308.   EOR.l d1,d7
  309.   AND.l d4,d6
  310.   AND.l d4,d7
  311.   EOR.l d6,d0
  312.   EOR.l d7,d1
  313.   LSL.l #2,d6
  314.   LSL.l #2,d7
  315.   MOVE.l  a5,(a2)+
  316.   EOR.l d6,d2
  317.   EOR.l d7,d3
  318.  
  319.   MOVE.l  #$00ff00ff,d4   ; Swap 8x2, parts 2 & 4
  320.   MOVE.l  d1,d6
  321.   MOVE.l  d3,d7
  322.   LSR.l #8,d6
  323.   LSR.l #8,d7
  324.   EOR.l d0,d6
  325.   EOR.l d2,d7
  326.   AND.l d4,d6
  327.   AND.l d4,d7
  328.   EOR.l d6,d0
  329.   EOR.l d7,d2
  330.   LSL.l #8,d6
  331.   LSL.l #8,d7
  332.   MOVE.l  a4,-c2pBPLSIZE-4(a2)
  333.   EOR.l d6,d1
  334.   EOR.l d7,d3
  335.  
  336.   MOVE.l  #$55555555,d4   ; Swap 1x2, parts 2 & 4
  337.   MOVE.l  d1,d6
  338.   MOVE.l  d3,d7
  339.   LSR.l #1,d6
  340.   LSR.l #1,d7
  341.   EOR.l d0,d6
  342.   EOR.l d2,d7
  343.   AND.l d4,d6
  344.   AND.l d4,d7
  345.   EOR.l d6,d0
  346.   EOR.l d7,d2
  347.   ADD.l d6,d6
  348.   ADD.l d7,d7
  349.   EOR.l d6,d1
  350.   EOR.l d7,d3
  351.  
  352.   MOVE.l  d0,d7
  353.   MOVE.l  d1,d4
  354.   MOVE.l  d2,a5
  355.   MOVE.l  d3,a6
  356.  
  357.   CMP.l a0,a3
  358.   BNE _x
  359. _xend
  360.  
  361.   MOVE.l  d7,c2pBPLSIZE*2(a1)
  362.   MOVE.l  d4,c2pBPLSIZE(a1)
  363.   MOVE.l  a5,(a1)+
  364.   MOVE.l  a6,-c2pBPLSIZE-4(a1)
  365. _none
  366.   MOVE.l  stackstore(pc),a7
  367.   MOVEM.l (a7)+,a3-a6
  368. AsmExit
  369.  
  370.   Even4
  371. stackstore: Dc.l 0
  372. c2p_data
  373. c2p_screen: Dc.l 0
  374. c2p_scroffs: Dc.l 0
  375. c2p_pixels: Dc.l 0
  376.   Ds.l  16
  377.   Even4
  378. c2p_datanew
  379.   Ds.l  16
  380. End Statement
  381.  
  382.  
  383.  
  384.  
  385. .blitzprogram
  386. ; Setup
  387. InitBank 0,(#scrwidth*#scrheight)+1000,2|65536 ; Chipram planar buffer
  388. CludgeBitMap 0,#scrwidth,#scrheight,8,Bank(0)
  389. InitPalette 0,256
  390. For c=0 To 255
  391.   AGAPalRGB 0,c,Rnd(c),Rnd(c),Rnd(c)
  392. Next c
  393. AGAPalRGB 0,0,0,0,0
  394. Screen 0,0,0,#scrwidth,#scrheight,8,0,"c2p test",0,0,0
  395. Use Palette 0
  396. VWait 50
  397. baseaddress1.l=AllocMem(#scrwidth*#scrheight,$10000) ; Fastram chunky buffer
  398.  
  399. ; Put something into the chunky buffer so we can see it working
  400. GetReg a0,baseaddress1
  401. MOVE.l  #0,d0
  402. MOVE.l  #screensize-1,d1
  403. cloop
  404.   MOVE.b  d0,(a0)+
  405.   ADDQ.l  #1,d0
  406.   SUBQ.l  #1,d1
  407.   TST.l   d1
  408.   BLT     done
  409.   BRA     cloop
  410. done
  411.  
  412. ; Do the c2p test
  413. c2p060onlyinit{#scrwidth,#scrheight}
  414. VWait 20
  415. Forbid_
  416. VWait
  417. ResetTimer
  418. For time=1 To 800
  419.   c2p060only{baseaddress1,Bank(0)} ; Convert chunky to planar
  420. Next time
  421. t=Ticks
  422. VWait 2 : Permit_
  423. VWait 20
  424. FindScreen 0
  425. Window 0,0,11,640,100,0,"Test results for c2p",0,0
  426. WindowOutput 0
  427. NPrint "Routine performed @ ",50/(t/800),"fps - ",t," ticks"
  428. NPrint " "
  429. NPrint "Press mousebutton..."
  430. Free Screen 0
  431. MouseWait
  432. Free Window 0
  433. End
  434.  
  435.